package remote.controls
{
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	import remote.events.SliderEvent;
	import remote.utils.DisplayObjectUtil;
	
	/**
	 * 水平方向滑块
	 * @author 银魂飞雪
	 * @createDate 2011-3-11
	 */
	public class HSlider extends SliderBase
	{
		public function HSlider()
		{
			super();
			
		}
		/**
		 * @inheritDoc 
		 * 
		 */	
		override protected function pointToValue(x:Number, y:Number):Number
		{
			var result:Number =  x * (this._maxValue - _minValue) / (_track.width - _thumb.width);
			if(this._stepSize != 0)
				result = (Math.floor(result / _stepSize)) * _stepSize;
			return result;
		}
		/**
		 * @inheritDoc 
		 * 
		 */	
		override protected function valueToPoint(value:Number):Point
		{
			return new Point(value * (_track.width - _thumb.width) / (maxValue - minValue), _thumb.y);
		}
		/**
		 * @inheritDoc 
		 * 
		 */	
		override protected function dragRect():Rectangle
		{
			return  new Rectangle(_track.x, 0, _track.width - _thumb.width, 0)
		}
		
		/**
		 * @inheritDoc 
		 * 
		 */	
		override protected function createChildren():void
		{
			super.createChildren();
			_track.setSize(width, height);
			_thumb.setSize(10, height);
			
		}
		/**
		 * @inheritDoc 
		 * 
		 */	
		override protected function initProperty():void
		{
			super.initProperty();
			_width = 100;
			_height = 10;
		}
		
		
	}
}